package com.aspose.cells;

import java.util.ArrayList;

final class zald {
   static int a = 4;
   static float b = 0.4F;

   private static com.aspose.cells.b.a.b.zt c(zn var0, zakx var1) {
      zbcs var3 = var1.c().a().z();
      com.aspose.cells.b.a.b.zt var4 = new com.aspose.cells.b.a.b.zt(0.0F, 0.0F);

      for(int var6 = 0; var6 < var3.getCount(); ++var6) {
         zbcq var2 = var3.c(var6);
         com.aspose.cells.b.a.b.zt var5 = var0.a(var2.i(), var1.c().h());
         if (var4.b() < var5.b()) {
            var4.a(var5.b());
         }

         if (var4.c() < var5.c()) {
            var4.b(var5.c());
         }
      }

      return var4;
   }

   private static boolean a(zbcs var0) {
      boolean var1 = false;

      for(int var2 = 0; var2 < var0.getCount(); ++var2) {
         zbcq var3 = var0.c(var2);
         if (var3.z().g() && var3.ak()) {
            var1 = true;
            break;
         }
      }

      return var1;
   }

   static com.aspose.cells.b.a.b.zt a(zn var0, zakx var1) {
      com.aspose.cells.b.a.b.zt var2 = c(var0, var1);
      boolean var3 = a(var1.c().a().z());
      if (var2.b() == 0.0F) {
         return var3 ? new com.aspose.cells.b.a.b.zt((float)zij.a, var1.c().D()) : new com.aspose.cells.b.a.b.zt((float)var1.m(), var1.c().D());
      } else {
         float var4 = var2.c() * zij.b;
         float var5 = var2.c();
         if (var3) {
            var4 = (float)zij.a;
         }

         return new com.aspose.cells.b.a.b.zt(var4, var5);
      }
   }

   static void a(zakx var0, com.aspose.cells.b.a.b.zp var1) {
      com.aspose.cells.b.a.b.zs var2 = var0.c().b.b();
      int var3 = var1.f();
      int var4 = var1.e();
      switch(var0.d()) {
      case 2:
      case 4:
         if (var0.c().a().M().c()) {
            var0.c().b.b(var1.d() + (var3 - var2.c()) / 2);
         } else {
            var0.c().b.b(var1.d() + (var3 - var2.c()) / 2);
         }
      case 0:
      case 1:
      case 3:
      case 5:
      default:
      }
   }

   static void a(zn var0, com.aspose.cells.b.a.b.zq var1, zbcq var2) {
      int var3 = var2.m();
      zalw var4 = (zalw)var2.z().l();
      int var5 = var4.h();
      if (var5 > 2) {
         var5 = 2;
      }

      var4.f().a((double)var5);
      float var6;
      com.aspose.cells.b.a.b.zq var7;
      if (var2.au()) {
         var6 = var1.h();
         var7 = new com.aspose.cells.b.a.b.zq(var1.f(), var1.g() + (var1.i() - var6) / 2.0F, var6, var6);
         com.aspose.cells.b.a.b.a.ze var8 = new com.aspose.cells.b.a.b.a.ze();
         var8.a(var7);
         var2.A().a(var8);
         var4.a(var8);
      } else if (!var2.ak()) {
         var6 = var1.h();
         var7 = new com.aspose.cells.b.a.b.zq(var1.f(), var1.g() + (var1.i() - var6) / 2.0F, var6, var6);
         var7 = zbuk.a(var7);
         var2.A().a(var7);
         var4.a(var7);
      } else {
         if (var2.z().g()) {
            var4.a(new com.aspose.cells.b.a.b.zo(var1.f(), var1.g() + var1.i() / 2.0F), new com.aspose.cells.b.a.b.zo(var1.f() + var1.h(), var1.g() + var1.i() / 2.0F));
         }

         if (var2.B().g()) {
            var6 = var1.f() + var1.h() / 2.0F;
            float var10 = var1.g() + var1.i() / 2.0F;
            float var9 = var1.i() * zij.b;
            float var11 = (float)var2.B().c();
            if (var11 > var9) {
               var11 = var9;
            }

            var2.B().a(var6, var10, var11);
         }
      }

   }

   static int a(zbcq var0, int var1) {
      if (var1 == -1) {
         return 3;
      } else if (var0.m() == 12) {
         return 7;
      } else {
         var1 %= 9;
         var1 += 2;
         switch(var1) {
         case 2:
            return 2;
         case 3:
            return 3;
         case 4:
            return 4;
         case 5:
            return 5;
         case 6:
            return 6;
         case 7:
            return 7;
         case 8:
            return 8;
         case 9:
            return 9;
         case 10:
            return 10;
         default:
            return 1;
         }
      }
   }

   static boolean a(zig var0) throws Exception {
      if (var0.z().getCount() != 1) {
         return false;
      } else {
         zbcq var1 = var0.z().c(0);
         int[] var2 = new int[]{14, 16, 17, 20, 18, 19, 15, 6, 8, 11, 9, 7, 37, 39, 42, 43, 38, 41, 40, 60, 61, 62, 63, 64, 57, 59, 58, 12, 13, 28, 30, 31, 33, 32, 34, 29, 21, 23, 22, 24, 26, 25, 27, 50, 52, 53, 55, 54, 56, 51};

         int var3;
         for(var3 = 0; var3 < var2.length && var1.m() != var2[var3]; ++var3) {
            ;
         }

         if (var3 == var2.length) {
            return false;
         } else {
            zjg var4 = var1.E();
            int var5 = var1.m();
            if (var1.I()) {
               return true;
            } else {
               return var4.getCount() > 0 && !a(var4);
            }
         }
      }
   }

   private static boolean a(zjg var0) throws Exception {
      for(int var1 = 1; var1 < var0.getCount(); ++var1) {
         if (!var0.b(0).i().a(var0.b(var1).i()) || !var0.b(0).k().b(var0.b(var1).k()) || !var0.b(0).m().a(var0.b(var1).m())) {
            return false;
         }
      }

      return true;
   }

   static void a(zn var0, zakx var1, zbcq var2) throws Exception {
      var1.c().z();
      zakz var3 = var1.e();
      int var4 = var1.e().a();
      zig var5 = var1.c().a();
      var1.c().G();
      float var6 = (float)var5.b() / 3.0F;
      com.aspose.cells.b.a.b.zt var7 = b(var0, var1);
      int var8 = var1.j();
      int var9 = var1.l();
      float var10 = var1.p();
      float var11 = var1.q();
      int var12 = 1;
      int var13 = var1.c().a.e();
      int var14 = var1.c().a.f();
      float var17 = 0.0F;
      float var18 = 0.0F;
      com.aspose.cells.b.a.b.zt var19 = com.aspose.cells.b.a.b.zt.a();
      int var20 = 0;
      com.aspose.cells.b.a.b.zt var21 = com.aspose.cells.b.a.b.zt.a();
      com.aspose.cells.b.a.b.zt var22 = a(var0, var1, new com.aspose.cells.b.a.b.zt((float)var5.a(), (float)var5.b()));
      int var23 = (int)(var7.b() * (float)var4 + var22.b());
      boolean var24 = false;
      boolean var25 = false;
      int var15;
      if (var23 <= var13 - var8) {
         var15 = var4;
         byte var16 = 1;
         var17 = (float)(var13 - var8 - var23) / (float)var4;
         var18 = ((float)var14 - var1.c().D() * (float)var16) / (float)var16;
         var25 = true;
         if (var17 > (float)var4 && var1.h()) {
            var17 = (float)(var13 - 2 * var8 - var23) / (float)var4;
            var24 = true;
         }
      } else {
         int var26 = var1.c().a.e() - var8;
         int var27 = var26 - (int)var7.b();
         var21 = new com.aspose.cells.b.a.b.zt((float)var27, var6);
         var19 = b(var0, var1, var21);
         var20 = (int)(var7.b() + var19.b());
         var15 = zbuk.b((double)((float)var26 / (float)var20));
         if (var15 < 1) {
            var15 = 1;
         }

         int var39;
         if (var1.c().s() && var1.r() > 0 && var15 == 1) {
            var39 = var1.r();
         } else {
            var39 = zbuk.a((double)((float)var4 / (float)var15));
         }

         if (var39 > 1 && var15 > var39) {
            int var28 = (int)Math.ceil((double)((float)var4 / (float)var39));
            if (var28 < var15) {
               var15 = var28;
            }
         }

         var17 = (float)(var26 - var20 * var15) / (float)var15;
         var18 = ((float)var14 - var19.c() * (float)var39) / (float)var39;
         var12 = zbuk.a((double)(var19.c() / var1.c().D()));
      }

      if (var17 < 0.0F) {
         var17 = 0.0F;
      }

      if (var12 > 1) {
         if (var18 < var11) {
            var18 = var11;
         }
      } else if (var18 < var10) {
         var18 = var10;
      }

      float var40 = (float)var1.c().a.c();
      float var41 = (float)var1.c().a.d();
      var40 += (float)var8;
      if (var24) {
         var40 += (float)var8;
      }

      var40 += var17 / 2.0F;
      var41 += var18 / 2.0F - 0.5F;
      com.aspose.cells.b.a.b.a.zf var42 = var0.e();
      com.aspose.cells.b.a.b.zq var29 = var0.f();
      var0.a(var1.c().a);
      com.aspose.cells.b.a.b.zv var30 = new com.aspose.cells.b.a.b.zv(com.aspose.cells.b.a.b.zv.c());

      for(int var31 = 0; var31 < var1.e().getCount(); ++var31) {
         zalb var32 = var1.e().b(var31);
         if (!var32.b()) {
            if (var41 > (float)var1.c().a.j()) {
               break;
            }

            com.aspose.cells.b.a.b.zq var33 = new com.aspose.cells.b.a.b.zq(var40, var41, var7.b(), var7.c());
            a(var0, var33, var2, var31);
            String var34 = var32.g();
            com.aspose.cells.b.a.b.zo var35 = new com.aspose.cells.b.a.b.zo(var40 + var7.b() + (float)var9, var41);
            if (var25) {
               var0.a(var34, var32.c(), new com.aspose.cells.b.a.b.zu(var32.e()), var35.d(), var35.e(), var30);
               com.aspose.cells.b.a.b.zs var36 = var1.c().a.b();
               if ((float)var36.c() < var1.c().D()) {
                  var36.b(zbuk.c((double)(var1.c().D() + 1.0F)));
               }

               com.aspose.cells.b.a.b.zt var37 = zbuk.a(var0, var34, var32.c(), var36);
               var40 += var7.b() + var37.b() + (float)(2 * var9);
               if (var5.aq() == ImageFormat.getEmf() && var32.c().h() <= 8.0F) {
                  if (var32.c().h() <= 6.0F) {
                     var40 += (float)var34.length() / 5.0F * (float)var9;
                  } else if (var32.c().h() <= 8.0F) {
                     var40 += (float)var34.length() / 10.0F * (float)var9;
                  }
               }

               var40 += var17;
            } else {
               float var43 = (float)zbuk.a((double)var21.b());
               float var44 = (float)zbuk.a((double)var21.c());
               com.aspose.cells.b.a.b.zq var38 = new com.aspose.cells.b.a.b.zq(var35.d(), var35.e(), var43, var44);
               var0.a(var34, var32.c(), new com.aspose.cells.b.a.b.zu(var32.e()), (com.aspose.cells.b.a.b.zq)var38, var30);
               var40 += (float)var20;
               var40 += var17;
               if ((var31 + 1) % var15 == 0) {
                  var40 = (float)(var1.c().a.c() + var8) + var17 / 2.0F;
                  var41 += var19.c();
                  var41 += var18;
               }
            }
         }
      }

      var0.a(var42);
   }

   static void a(zn var0, com.aspose.cells.b.a.b.zq var1, zbcq var2, int var3) {
      int var4 = var2.m();
      zje var5 = var2.E().b(var3);
      if (var5 == null) {
         var5 = var2.u();
      }

      float var6;
      if (var2.au()) {
         var6 = (float)var2.v().x().m();
         com.aspose.cells.b.a.b.zq var10 = new com.aspose.cells.b.a.b.zq(var1.f(), var1.g() + (var1.i() - var6) / 2.0F, var6, var6);
         com.aspose.cells.b.a.b.a.ze var12 = new com.aspose.cells.b.a.b.a.ze();
         var12.a(var10);
         var5.i().a(var12);
         var5.k().a(var12);
      } else {
         float var7;
         if (!var2.ak()) {
            var6 = var1.h();
            var7 = var1.h();
            com.aspose.cells.b.a.b.zq var11 = new com.aspose.cells.b.a.b.zq(var1.f(), var1.g() + var1.i() / 2.0F - var7 / 2.0F, var6, var7);
            var11 = zbuk.a(var11);
            var5.i().a(var11);
            var5.k().a(var11);
         } else {
            if (var2.z().g()) {
               var5.k().a(var1.f(), var1.g() + var1.i() / 2.0F, var1.f() + var1.h(), var1.g() + var1.i() / 2.0F);
            }

            if (var5.m().g()) {
               var6 = var1.f() + var1.h() / 2.0F;
               var7 = var1.g() + var1.i() / 2.0F;
               float var8;
               if (var2.B().c() == 0) {
                  var8 = var1.i() * b;
               } else if ((float)var2.B().c() <= var1.i() * b) {
                  var8 = (float)var2.B().c();
               } else {
                  float var9 = (float)(var2.B().c() / var2.v().i().m());
                  if (var9 > 1.0F) {
                     var9 = 1.0F;
                  }

                  var8 = var1.i() * b * (1.0F + var9);
               }

               var5.m().a(var6, var7, var8);
            }

         }
      }
   }

   static String a(zig var0, zafr var1, boolean var2) {
      String var3;
      for(var3 = b(var0, var1, var2); var1.e() != null; var3 = b(var0, var1, var2) + " " + var3) {
         var1 = var1.e();
      }

      return var3;
   }

   private static String b(zig var0, zafr var1, boolean var2) {
      String var3 = var1.c();
      if (var1.f()) {
         double var4 = com.aspose.cells.b.a.ze.g(var1.a());
         DateTime var6 = zbuk.a(var4, var2);
         return zgc.a(var0.al(), var6, var3);
      } else {
         return zgc.a(var0.al(), var1.a(), var3);
      }
   }

   static com.aspose.cells.b.a.b.zs a(zn var0, zakx var1, zbcq var2, com.aspose.cells.b.a.b.zp var3, boolean var4) throws Exception {
      if (!var1.c().s() && var4) {
         return var1.c().r();
      } else {
         zig var5 = var2.v();
         int var6 = var1.e().a();
         int var10 = var1.j();
         int var11 = var1.k();
         com.aspose.cells.b.a.b.zt var7;
         int var8;
         int var9;
         com.aspose.cells.b.a.b.zt var12;
         int var15;
         int var18;
         if (var1.d() != 5 && var1.d() != 0) {
            var12 = b(var0, var1);
            int var21 = (int)((float)(var3.f() + 2 * zia.a) * 0.9F);
            int var22 = var5.a() / 3;
            var15 = zbuk.b((double)((float)(var22 - var1.j()) - var12.b()));
            com.aspose.cells.b.a.b.zt var23 = new com.aspose.cells.b.a.b.zt((float)var15, (float)var21);
            var7 = b(var0, var1, var23);
            var8 = (int)((float)var10 + var12.b() + var7.b()) + 1;
            float var24 = var7.c() + (float)var11;
            var9 = (int)((float)var6 * var24);
            if (var8 > var1.c().a().a()) {
               var8 = var1.c().a().a();
            }

            if (var9 > var21) {
               var18 = (int)((float)var21 / var24);
               var9 = zbuk.a((double)((float)var18 * var24));
               var1.b(var18);
            }
         } else {
            var12 = b(var0, var1);
            com.aspose.cells.b.a.b.zt var13 = new com.aspose.cells.b.a.b.zt((float)(var1.c().a().a() - 2 * zia.a), (float)(var1.c().a().i().m() / 2 - zia.a));
            com.aspose.cells.b.a.b.zt var14 = b(var0, var1, var13);
            var15 = (int)(var12.b() + var14.b()) + 1;
            int var16 = var1.c().a().i().l() - 2 * zia.a - var10;
            int var17 = var16 / var15;
            if (var17 == 0) {
               var17 = 1;
            }

            var7 = a(var0, var1, var13);
            var18 = (int)(var12.b() * (float)var6 + var7.b()) + 1;
            if (var18 <= var16) {
               int var10000 = var10 + var18;
               var8 = var18 + var10 * var6 * 2;
               var1.d(true);
               var9 = (int)var7.c() + 2 * var10;
            } else {
               int var19 = zbuk.a((double)var6 / (double)var17);
               int var20 = zbuk.a((double)var6 / (double)var19);
               var8 = var10 + var20 * var15;
               var9 = var19 * (int)var7.c() + 2 * var10;
            }

            if (var9 > var1.c().a().i().m() - 2 * zia.a) {
               var9 = var1.c().a().i().m() - 2 * zia.a;
            }
         }

         return new com.aspose.cells.b.a.b.zs(var8, var9);
      }
   }

   static com.aspose.cells.b.a.b.zn a(zn var0, zakx var1, zbcq var2, com.aspose.cells.b.a.b.zp[] var3) throws Exception {
      zig var4 = var1.c().a();
      float var5 = 0.0F;
      float var6 = 0.0F;
      com.aspose.cells.b.a.b.zs var7 = a(var0, var1, var2, var3[0], false);
      int var8 = zia.a;
      int var9 = zia.b;
      var1.c().b.a(var7);
      switch(var1.d()) {
      case 0:
         var5 = (float)((var4.a() - var7.b()) / 2);
         var6 = (float)(var4.ak().j() - var8 - var7.c());
         var3[0].d(var3[0].f() - (var7.c() + var9));
         var4.i.d(var3[0].j() - var4.i.d());
         break;
      case 1:
         var5 = (float)(var4.ak().i() - var8 - var7.b());
         if (var1.c().a().M().l()) {
            var6 = (float)(var4.ak().d() + var8 + var1.c().a().M().e().b.f() + var9);
         } else {
            var6 = (float)(var4.ak().d() + var8);
         }

         var3[0].c(var3[0].e() - (var7.b() + var9));
         break;
      case 2:
         var5 = (float)(var4.ak().c() + var8);
         var6 = (float)((var4.b() - var7.c()) / 2);
         var3[0].a(var3[0].c() + var7.b() + var9);
         var3[0].c(var3[0].e() - (var7.b() + var9));
         if (var3[0].c() - var9 - var4.i.c() > 0) {
            var4.i.c(var4.i.e() - (var3[0].c() - var9 - var4.i.c()));
            var4.i.a(var3[0].c() - var9);
         }
         break;
      case 3:
         var5 = (float)(var1.c().i() * var4.ak().e() / 4000);
         var6 = (float)(var1.c().n() * var4.ak().f() / 4000);
         var1.c().b.a((int)var5);
         var1.c().b.b((int)var6);
         var1.c().b.a(var7);
         return new com.aspose.cells.b.a.b.zn(var1.c().b.c(), var1.c().b.d());
      case 4:
         var5 = (float)(var4.ak().i() - var8 - var7.b());
         var6 = (float)((var4.b() - var7.c()) / 2);
         var3[0].c(var3[0].e() - (var7.b() + var9));
         var4.i.c(var3[0].i() - var4.i.c());
         break;
      case 5:
         var5 = (float)((var4.a() - var7.b()) / 2);
         var6 = (float)(var4.ak().d() + var8 + var1.c().a().M().e().b.f() + var9);
         var3[0].b(var3[0].d() + var7.c() + var9);
         var3[0].d(var3[0].f() - (var7.c() + var9));
         if (var3[0].d() - var9 - var4.i.d() > 0) {
            var4.i.d(var4.i.f() - (var3[0].d() - var9 - var4.i.d()));
            var4.i.b(var3[0].d() - var9);
         }
      }

      var1.c().b.a((int)var5);
      var1.c().b.b((int)var6);
      var1.c().b.a(var7);
      return new com.aspose.cells.b.a.b.zn(var1.c().b.c(), var1.c().b.d());
   }

   static com.aspose.cells.b.a.b.zn a(zn var0, zakx var1, com.aspose.cells.b.a.b.zp[] var2) throws Exception {
      float var3 = 0.0F;
      float var4 = 0.0F;
      com.aspose.cells.b.a.b.zs var5 = a(var0, var1, var2[0]);
      int var6 = var1.c().a().b();
      int var7 = var1.c().a().a();
      int var8 = zia.a;
      int var9 = zia.b;
      zig var10 = var1.c().a();
      switch(var1.d()) {
      case 0:
         var3 = (float)((var7 - var5.b()) / 2);
         var4 = (float)(var6 - var8 - var5.c());
         if (!var1.s()) {
            var2[0].d(var2[0].f() - (var5.c() + var9));
            var10.i.d(var2[0].j() - var10.i.d());
         }
         break;
      case 1:
         var3 = (float)(var7 - var8 - var5.b());
         if (var1.c().a().M().l()) {
            var4 = (float)(var8 + var1.c().a().M().e().b.f() + var9);
         } else {
            var4 = (float)var8;
         }

         if (!var1.s()) {
            var2[0].c(var2[0].e() - (var5.b() + var9));
            if (var2[0].f() > var5.c() * 3) {
               var2[0].b(var2[0].d() + var5.c() + var9);
               var2[0].d(var2[0].f() - (var5.c() + var9));
            }
         }
         break;
      case 2:
         var3 = (float)var8;
         var4 = (float)((var6 - var5.c()) / 2);
         if (!var1.s()) {
            var2[0].a(var2[0].c() + var5.b() + var9);
            var2[0].c(var2[0].e() - (var5.b() + var9));
            if (var2[0].c() - var9 - var10.i.c() > 0) {
               var10.i.c(var10.i.e() - (var2[0].c() - var9 - var10.i.c()));
               var10.i.a(var2[0].c() - var9);
            }
         }
         break;
      case 3:
         var3 = (float)var1.c().v();
         var4 = (float)var1.c().w();
         var1.c().b.a((int)var3);
         var1.c().b.b((int)var4);
         var1.c().b.a(var5);
         return new com.aspose.cells.b.a.b.zn(var1.c().b.c(), var1.c().b.d());
      case 4:
         var3 = (float)(var7 - var8 - var5.b());
         var4 = (float)((var6 - var5.c()) / 2);
         if (!var1.s()) {
            var2[0].c(var2[0].e() - (var5.b() + var9));
            var10.i.c(var2[0].i() - var10.i.c());
         }
         break;
      case 5:
         var3 = (float)((var7 - var5.b()) / 2);
         if (var1.c().a().M().e().b.f() == 0) {
            var4 = (float)var8;
         } else {
            var4 = (float)(var8 + var1.c().a().M().e().b.f() + var9);
         }

         if (!var1.s()) {
            var2[0].b(var2[0].d() + var5.c() + var9);
            var2[0].d(var2[0].f() - (var5.c() + var9));
            if (var2[0].d() - var9 - var10.i.d() > 0) {
               var10.i.d(var10.i.f() - (var2[0].d() - var9 - var10.i.d()));
               var10.i.b(var2[0].d() - var9);
            }
         }
      }

      var1.c().b.a((int)var3);
      var1.c().b.b((int)var4);
      var1.c().b.a(var5);
      return new com.aspose.cells.b.a.b.zn(var1.c().b.c(), var1.c().b.d());
   }

   private static com.aspose.cells.b.a.b.zs a(zn var0, zakx var1, com.aspose.cells.b.a.b.zp var2) throws Exception {
      com.aspose.cells.b.a.b.zt var3 = b(var0, var1);
      zig var4 = var1.c().a();
      zix var5 = var1.c();
      int var6 = var1.j();
      int var7 = var1.l();
      int var8 = var1.k();
      zbcs var9 = var1.c().a().z();
      int var12 = var1.e().a();
      int var10;
      int var11;
      com.aspose.cells.b.a.b.zt var13;
      com.aspose.cells.b.a.b.zt var14;
      int var15;
      int var16;
      int var17;
      int var19;
      if (var1.d() == 5 || var1.d() == 0 || var1.d() == 3 && !var1.i()) {
         var13 = new com.aspose.cells.b.a.b.zt((float)(var1.c().a().a() - 2 * zia.a), (float)(var1.c().a().i().m() / 2 - zia.a));
         var14 = b(var0, var1, var13);
         var15 = zbuk.a((double)(var3.b() + var14.b()));
         var16 = zbuk.c((double)var13.b()) - var6;
         var17 = var16 / var15;
         if (var17 == 0) {
            var17 = 1;
         }

         com.aspose.cells.b.a.b.zt var23 = a(var0, var1, var13);
         var19 = zbuk.a((double)(var3.b() * (float)var12 + var23.b()));
         if (var19 <= var16) {
            var1.c(false);
            var10 = var19 + (var6 + var7) * var12 * 2;
            var1.d(true);
            if (var10 > var16) {
               var10 = var16;
            }

            var11 = zbuk.a((double)(var23.c() + (float)(2 * var6)));
         } else {
            var1.c(false);
            var10 = var6 + var17 * var15 + var7;
            var11 = zbuk.a((double)((float)var12 / (float)var17)) * (zbuk.a((double)var14.c()) + var7) + 2 * var6;
            int var20 = var4.i().m() / 2 - zia.a;
            if (var11 > var20) {
               int var21 = 0;

               int var22;
               for(var22 = 0; var21 <= var20 && var22 <= var12; var22 += var17) {
                  var21 = zbuk.a((double)((float)var22 / (float)var17)) * (zbuk.a((double)var14.c()) + var7) + 2 * var6;
               }

               if (var22 < var12 && var21 != var20) {
                  if (var21 > var20) {
                     var11 = var21 - (zbuk.a((double)var14.c()) + var7);
                  }
               } else {
                  var11 = var21;
               }
            }
         }

         if (var11 > var4.i().m() - 2 * zia.a) {
            var11 = var4.i().m() - 2 * zia.a;
         }
      } else {
         var1.c(true);
         var15 = (int)((float)(var2.f() + 2 * zia.a) * 0.9F);
         var16 = var4.a() / 3;
         var17 = zbuk.b((double)((float)(var16 - var6) - var3.b()));
         var13 = new com.aspose.cells.b.a.b.zt((float)var17, (float)var15);
         var14 = b(var0, var1, var13);
         var10 = zbuk.a((double)((float)var6 + var3.b() + var14.b()));
         float var18 = var14.c() + (float)var8;
         var11 = zbuk.a((double)((float)var12 * var18));
         if (var10 > var16) {
            var10 = var16;
         }

         if (var11 > var15) {
            var19 = (int)((float)var15 / var18);
            var11 = zbuk.a((double)((float)var19 * var18));
            var1.b(var19);
         }
      }

      return new com.aspose.cells.b.a.b.zs(var10, var11);
   }

   static com.aspose.cells.b.a.b.zt a(zn var0, zakx var1, com.aspose.cells.b.a.b.zt var2) {
      zig var3 = var1.c().a();
      zakz var4 = var1.e();
      com.aspose.cells.b.a.b.zt var5 = new com.aspose.cells.b.a.b.zt(0.0F, 0.0F);
      int var7 = var1.l();

      for(int var8 = 0; var8 < var4.getCount(); ++var8) {
         String var9 = var4.b(var8).g();
         if (!var4.b(var8).b()) {
            com.aspose.cells.b.a.b.zt var6 = zbuk.a(var0, var9, var4.b(var8).c(), var2);
            var6.a(var6.b() + (float)(2 * var7));
            if (var3.aq() == ImageFormat.getEmf() && var4.b(var8).c().h() <= 10.0F) {
               if (var4.b(var8).c().h() <= 6.0F) {
                  var6.a(var6.b() + (float)(var9.length() * var7) / 5.0F);
               } else if (var4.b(var8).c().h() <= 8.0F) {
                  var6.a(var6.b() + (float)(var9.length() * var7) / 10.0F);
               } else if (var4.b(var8).c().h() <= 10.0F) {
                  var6.a(var6.b() + (float)var9.length() * 0.5F);
               }
            }

            var5.a(var5.b() + var6.b());
            if (var5.c() < var6.c()) {
               var5.b(var6.c());
            }
         }
      }

      return var5;
   }

   static com.aspose.cells.b.a.b.zt b(zn var0, zakx var1) {
      return var1.e().b() ? var1.o() : new com.aspose.cells.b.a.b.zt((float)var1.m(), var1.c().D());
   }

   static com.aspose.cells.b.a.b.zt b(zn var0, zakx var1, com.aspose.cells.b.a.b.zt var2) {
      zig var3 = var1.c().a();
      var2 = new com.aspose.cells.b.a.b.zt(var2.b(), var2.c());
      zakz var5 = var1.e();
      com.aspose.cells.b.a.b.zt var6 = new com.aspose.cells.b.a.b.zt(0.0F, 0.0F);
      int var8 = var1.l();

      for(int var9 = 0; var9 < var5.getCount(); ++var9) {
         zalb var4 = var5.b(var9);
         String var10 = var4.g();
         if (!var4.b()) {
            com.aspose.cells.b.a.b.zt var7 = zbuk.a(var0, var10, var5.b(var9).c(), var2);
            if (var4.i()) {
               zbai var11 = new zbai();
               var11.a(0);
               var11.b(0);
               com.aspose.cells.b.a.b.zq var12 = new com.aspose.cells.b.a.b.zq(0.0F, 0.0F, var2.b(), var2.c());
               zbaq var13 = new zbaq(var12, var11, var4.h(), var4.c());
               var7 = var13.a(var0).e();
            }

            var7.a(var7.b() + (float)(2 * var8));
            if (var3.aq() == ImageFormat.getEmf() && var5.b(var9).c().h() <= 10.0F) {
               if (var5.b(var9).c().h() <= 6.0F) {
                  var7.a(var7.b() + (float)(var10.length() * var8) / 5.0F);
               } else if (var5.b(var9).c().h() <= 8.0F) {
                  var7.a(var7.b() + (float)(var10.length() * var8) / 10.0F);
               } else if (var5.b(var9).c().h() <= 10.0F) {
                  var7.a(var7.b() + (float)var10.length() * 0.5F);
               }
            }

            if (var6.b() < var7.b()) {
               var6.a(var7.b());
            }

            if (var6.c() < var7.c()) {
               var6.b(var7.c());
            }
         }
      }

      return var6;
   }

   static void a(zn var0, zakx var1, boolean var2, zbcq var3) throws Exception {
      var1.c().z();
      ArrayList var4 = var1.e().a(var1.g(), var2);
      int var5 = var4.size();
      zig var6 = var1.c().a();
      var1.c().G();
      float var7 = (float)var6.b() / 3.0F;
      com.aspose.cells.b.a.b.zt var8 = b(var0, var1);
      int var9 = var1.j();
      int var10 = var1.l();
      float var11 = var1.p();
      float var12 = var1.q();
      int var13 = 1;
      int var14 = var1.c().a.e();
      int var15 = var1.c().a.f();
      float var18 = 0.0F;
      float var19 = 0.0F;
      com.aspose.cells.b.a.b.zt var20 = com.aspose.cells.b.a.b.zt.a();
      int var21 = 0;
      com.aspose.cells.b.a.b.zt var22 = com.aspose.cells.b.a.b.zt.a();
      com.aspose.cells.b.a.b.zt var23 = a(var0, var1, new com.aspose.cells.b.a.b.zt((float)var6.a(), (float)var6.b()));
      int var24 = (int)(var8.b() * (float)var5 + var23.b());
      boolean var25 = false;
      boolean var26 = false;
      int var16;
      if (var24 - var5 <= var14) {
         var16 = var5;
         byte var17 = 1;
         var18 = (float)(var14 - var9 - var24) / (float)var5;
         var19 = ((float)var15 - var1.c().D() * (float)var17) / (float)var17;
         var25 = true;
         if (var18 > (float)var5 && var1.h()) {
            var18 = (float)(var14 - 2 * var9 - var24) / (float)var5;
            var26 = true;
         }
      } else {
         int var27 = var1.c().a.e() - var9;
         int var28 = var27 - (int)var8.b();
         var22 = new com.aspose.cells.b.a.b.zt((float)var28, var7);
         var20 = b(var0, var1, var22);
         var21 = (int)(var8.b() + var20.b());
         var16 = zbuk.b((double)((float)var27 / (float)var21));
         if (var16 < 1) {
            var16 = 1;
         }

         int var51;
         if (var1.c().s() && var1.r() > 0 && var16 == 1) {
            var51 = var1.r();
         } else {
            var51 = zbuk.a((double)((float)var5 / (float)var16));
         }

         if (var51 > 1 && var16 > var51) {
            int var29 = (int)Math.ceil((double)((float)var5 / (float)var51));
            if (var29 < var16) {
               var16 = var29;
            }
         }

         var18 = (float)(var27 - var21 * var16) / (float)var16;
         var19 = ((float)var15 - var20.c() * (float)var51) / (float)var51;
         var13 = zbuk.a((double)(var20.c() / var1.c().D()));
      }

      if (var18 < 0.0F) {
         var18 = 0.0F;
      }

      if (var13 > 1) {
         if (var19 < var12) {
            var19 = var12;
         }
      } else if (var19 < var11) {
         var19 = var11;
      }

      float var52 = (float)var1.c().a.c();
      float var53 = (float)var1.c().a.d();
      var52 += (float)var9;
      if (var26) {
         var52 += (float)var9;
      }

      var52 += var18 / 2.0F;
      var53 += var19 / 2.0F - 0.5F;
      com.aspose.cells.b.a.b.a.zf var54 = var0.e();
      com.aspose.cells.b.a.b.zq var30 = var0.f();
      var0.a(var1.c().a);
      com.aspose.cells.b.a.b.zv var31 = new com.aspose.cells.b.a.b.zv(com.aspose.cells.b.a.b.zv.c());

      for(int var32 = 0; var32 < var4.size(); ++var32) {
         zalb var33 = (zalb)var4.get(var32);
         if (var53 > (float)var1.c().a.j()) {
            break;
         }

         com.aspose.cells.b.a.b.zq var34 = new com.aspose.cells.b.a.b.zq(var52, var53, var8.b(), var8.c());
         a(var0, var1, var34, var33);
         String var35 = var33.g();
         com.aspose.cells.b.a.b.zo var36 = new com.aspose.cells.b.a.b.zo(var52 + var8.b() + (float)var10, var53);
         float var38;
         if (var33.a().c() || var33.a().d()) {
            com.aspose.cells.b.a.b.zg var37 = var33.d();
            var38 = (float)Math.ceil((double)var0.a().a(var37));
            float var39 = var38 * (float)var37.b().c(var37.k()) / (float)var37.b().e(var37.k());
            float var40 = var38 * (float)var37.b().d(var37.k()) / (float)var37.b().e(var37.k());
            float var41 = var38 * (float)var37.b().f(var37.k()) / (float)var37.b().e(var37.k());
            float var42 = var41 - var39 - var40;
            float var43 = var36.e() - (var41 - var38) / 2.0F + var39;
            com.aspose.cells.b.a.b.zg var44 = var33.c();
            float var45 = (float)Math.ceil((double)var0.a().a(var44));
            float var46 = var45 * (float)var44.b().d(var44.k()) / (float)var44.b().e(var44.k());
            float var47 = var45 * (float)var44.b().c(var44.k()) / (float)var44.b().e(var44.k());
            float var48 = var45 * (float)var44.b().f(var44.k()) / (float)var44.b().e(var44.k());
            float var49 = var48 - var47 - var46;
            float var50 = var43 - var47 - 1.0F;
            var36.b(var50 - (float)(var33.a().e() / 100.0D * (double)var38));
         }

         if (var25) {
            if (var33.i()) {
               zbai var55 = new zbai();
               var55.a(0);
               var55.b(0);
               com.aspose.cells.b.a.b.zq var58 = new com.aspose.cells.b.a.b.zq(var36.d(), var36.e(), 2.14748365E9F, 2.14748365E9F);
               zbaq var60 = new zbaq(var58, var55, var33.h(), var33.c());
               var60.b(var0);
            } else {
               var0.a(var33.g(), var33.c(), new com.aspose.cells.b.a.b.zu(var33.e()), var36.d(), var36.e(), var31);
            }

            com.aspose.cells.b.a.b.zs var56 = var1.c().a.b();
            if ((float)var56.c() < var1.c().D()) {
               var56.b(zbuk.c((double)(var1.c().D() + 1.0F)));
            }

            com.aspose.cells.b.a.b.zt var59 = zbuk.a(var0, var35, var33.c(), var56);
            var52 += var8.b() + var59.b() + (float)(2 * var10);
            if (var6.aq() == ImageFormat.getEmf() && var33.c().h() <= 8.0F) {
               if (var33.c().h() <= 6.0F) {
                  var52 += (float)var35.length() / 5.0F * (float)var10;
               } else if (var33.c().h() <= 8.0F) {
                  var52 += (float)var35.length() / 10.0F * (float)var10;
               }
            }

            var52 += var18;
         } else {
            float var57 = (float)zbuk.a((double)var22.b());
            var38 = var22.c();
            com.aspose.cells.b.a.b.zq var61 = new com.aspose.cells.b.a.b.zq(var36.d(), var36.e(), var57, var38);
            if (var33.i()) {
               zbai var62 = new zbai();
               var62.a(0);
               var62.b(0);
               zbaq var63 = new zbaq(var61, var62, var33.h(), var33.c());
               var63.b(var0);
            } else {
               var0.a(var33.g(), var33.c(), new com.aspose.cells.b.a.b.zu(var33.e()), (com.aspose.cells.b.a.b.zq)var61, var31);
            }

            var52 += (float)var21;
            var52 += var18;
            if ((var32 + 1) % var16 == 0) {
               var52 = (float)(var1.c().a.c() + var9) + var18 / 2.0F;
               var53 += var20.c();
               var53 += var19;
            }
         }
      }

      var0.a(var54);
   }

   static void a(zn var0, zakx var1, com.aspose.cells.b.a.b.zq var2, zalb var3) {
      int var4 = a(var3.d());
      if (var3.j() == 2) {
         com.aspose.cells.b.a.b.zo var5 = new com.aspose.cells.b.a.b.zo(var2.f(), var2.g() + var2.i() / 2.0F);
         com.aspose.cells.b.a.b.zo var6 = new com.aspose.cells.b.a.b.zo(var2.l(), var2.g() + var2.i() / 2.0F);
         zalw var7 = (zalw)var3.l().d().l();
         if (var7.h() > var4) {
            var7.f().a((double)var4);
         }

         var7.a(var5, var6);
      } else if (var3.j() == 1) {
         zbcq var10 = var3.k();
         zalw var11 = (zalw)var10.z().l();
         if (var11.h() > var4) {
            var11.f().a((double)var4);
         }

         float var12;
         if (var10.au()) {
            var12 = (float)var1.m();
            com.aspose.cells.b.a.b.zq var8 = new com.aspose.cells.b.a.b.zq(var2.f(), var2.g() + (var2.i() - var12) / 2.0F, var12, var12);
            com.aspose.cells.b.a.b.a.ze var9 = new com.aspose.cells.b.a.b.a.ze();
            var9.a(var8);
            var10.A().a(var9);
            var11.a(var9);
         } else {
            float var13;
            if (var10.ak()) {
               if (var11.g()) {
                  var11.a(var2.f(), var2.g() + var2.i() / 2.0F, var2.f() + var2.h(), var2.g() + var2.i() / 2.0F);
               }

               if (var10.B().d() != 1) {
                  var12 = var2.f() + var2.h() / 2.0F;
                  var13 = var2.g() + var2.i() / 2.0F;
                  float var14;
                  if (var10.B().c() == 0) {
                     var14 = var2.i() * zij.b;
                  } else if ((float)var10.B().c() <= var2.i() * zij.b) {
                     var14 = (float)var10.B().c();
                  } else {
                     var14 = var2.i() * zij.b;
                  }

                  var10.B().a(var12, var13, var14);
               }
            } else {
               var12 = var2.h();
               var13 = (float)var1.m();
               com.aspose.cells.b.a.b.zq var15 = new com.aspose.cells.b.a.b.zq(var2.f(), var2.g() + var2.i() / 2.0F - var13 / 2.0F, var12, var13);
               var15 = zbuk.a(var15);
               var10.A().a(var15);
               var11.a(var15);
            }
         }
      }

   }

   private static int a(com.aspose.cells.b.a.b.zg var0) {
      float var1 = var0.h();
      if (var1 <= 4.0F) {
         return 1;
      } else if (var1 <= 6.0F) {
         return 2;
      } else if (var1 <= 8.0F) {
         return 3;
      } else if (var1 <= 9.0F) {
         return 4;
      } else if (var1 <= 10.0F) {
         return 5;
      } else if (var1 <= 12.0F) {
         return 6;
      } else if (var1 <= 13.0F) {
         return 7;
      } else {
         return var1 <= 15.0F ? 8 : (int)(var1 - 8.0F);
      }
   }
}
